// 显示时间的操作
var timeFormat = (time)=>{
  var weekday = ["星期日", "星期一", "星期二", "星期三", "星期五","星期六"]
  let msgTime = new Date(time)
  let currentTime = new Date()

  if(msgTime.getDay() === currentTime.getDay())
    return '今天 '+ time.slice(11,16)
  else if (msgTime.getDay() === (currentTime.getDay()-1))
    return '昨天 '+ time.slice(11,16)
  else if(msgTime.getDay() >= currentTime.getDay() - 7)
    return weekday[msgTime.getDay()]
  else return time.slice(0,10);
}

export default timeFormat
